#include <stdio.h>
#include<math.h>


float maxb(float b[], int N)
{
	int i;
	float x=0;
	for(i=0; i<N; i++)
		if(b[i]>x)
			x=b[i];

	return(x);
}

int maxi(float b[], int N)
{
	int i;
	float m;
	m=maxb(b,N);
	for (i=0;i<N;i++)
		if (m==b[i]) 
			return(i);
}

float max(float a[], int N)
{
	int i;
	float x=0;
	for(i=0; i<N; i++)
		if(a[i]>x)
			x=a[i];
	return(x);
}

float min(float a[], int N)
{
	int i;
	float x=a[0];
	for(i=0; i<N; i++)
		if(a[i]<x)
			x=a[i];
	return(x);
}

float mean(float a[], int N)
{
	int i;
	float x=0;
	for(i=0;i<N;i++)
		x=x+a[i];
	x=x/(float)N;
	return(x);
}

float med(float a[],int N)
{
	int j,i,n;
	float x=0,b[1000],t;
	if (N%2==1)
		n=(N+1)/2;
	else n=N/2+1;

	for (i=0;i<N;i++)
		b[i]=a[i];

	for (i=n;i<N;i++)
		if(b[i] < maxb(b,n))
		{
			j=maxi(b,n);
			x=b[i];
			b[i]=b[j];
			b[j]=x;
		}

	if (N%2==1)
		x=maxb(b,n);
	else 
	{
		t=maxb(b,n);
		b[maxi(b,n)]=0;
		x=(t+maxb(b,n))/(float)2;
	}
	return(x);
}

float sko(float a[],int N)
{
	int i;
	float x=0,t=mean(a,N);
	for(i=0;i<N;i++)
	
		x=x+(a[i]-t)*(a[i]-t);
	x=sqrt(x)/N;
	return(x);
}

float podr(float a[],int N)
{
	int k=0,i;
    float b[1000],t;
	t=a[0];
	b[0]=1;
	for(i=1;i<N;i++)
	{
		b[i]=1;
		if(a[i]==t)
			b[k]++;
		else 
		{
			t=a[i];	
			k++;
		}
	}
	return(maxb(b,N));
}

float monoton(float a[],int N)
{
	int k=0,i;
    float b[1000],t,o,x;
	t=a[0];
	b[0]=1;
	for(i=1;i<N;i++)
	{
		b[i]=1;
		if(a[i]<=t)
			{
				b[k]++;
				t=a[i];
		}
		else 
		{
			t=a[i];	
			k++;
		}
	}

	o=maxb(b,N);

	k=0;
	t=a[0];
	b[0]=1;
	for(i=1;i<N;i++)
	{
		b[i]=1;
		if(a[i]>=t)
			{
				b[k]++;
				t=a[i];
		}
		else 
		{
			t=a[i];	
			k++;
		}
	}

	x=maxb(b,N);

	if(o>x)
		x=o;
	return(x);

}

	
void main()
{
	
	int N,i;
	float a[1000];
	printf("Enter N");

    scanf("%d", &N );

	for (i=0;i<N;i++)
		scanf("%fl", &a[i]);
	
	
	printf("The maximum number - %fl\n", max(a,N));	
	printf("The maximum number - %fl\n", min(a,N));
	printf("The arithmetical mean - %fl\n", mean(a,N)); 
	printf("The median - %fl\n", med(a,N));
	printf("The standard deviation - %fl\n", sko(a,N));
	printf("The maximum number of consecutive identical elements - %fl\n", 	podr(a,N));
	printf("The maximum number of consecutive identical elements - %fl\n",monoton(a,N));
	 system("PAUSE");
}